package com.bj.zspace.project.reactor.netty.tcp;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.DisposableServer;
import reactor.netty.tcp.TcpServer;

public class TcpServerTest1 {

    public static void main(String[] args) {

        TcpServer server = TcpServer.create().handle((in, out) -> {
            Flux<String> string = in.receive().asString();
            string.subscribe(System.out::println);
            return  out.sendString( string);
        } );
        DisposableServer disposableServer = server.host("localhost")
                .port(8080)
                .bindNow();
        disposableServer.onDispose().block();


    }

}
